import { Statistic, Card, Row, Col } from 'antd';
import React, {Component} from 'react';
import axios from 'axios'
import {SHUJUFENXI} from '../utils/api'
let style={
    background: '#ececec',
    padding: '30px',
};

class EchartsTest extends Component {
    constructor() {
        super();
        this.state={
            data:[]
        }
    }
    componentDidMount() {
        axios({
            url:SHUJUFENXI,
            method:'get',
            params: {

            }
        }).then(data=>{
            this.setState({
                data:data.data.data
            });
        });
    }
    render() {
        return (
            <div style={style}>
                <Row gutter={16}>
                    <Col span={6}>
                        <Card >
                            <Statistic
                                title="总销量"
                                value={this.state.data.sales}
                                valueStyle={{fontsize:26}}
                            />
                        </Card>
                    </Col>
                    <Col span={6}>
                        <Card>
                            <Statistic
                                title="总退货量"
                                value={this.state.data.tongjirefund}
                                valueStyle={{ color: "#cf1322" }}
                            />
                        </Card>
                    </Col>
                    <Col span={6}>
                        <Card>
                            <Statistic
                                title="总退货款"
                                value={this.state.data.totalrefund}
                                valueStyle={{ color: '#cf1322' }}
                            />
                        </Card>
                    </Col>
                    <Col span={6}>
                        <Card>
                            <Statistic
                                title="总营业额"
                                value={this.state.data.totalsales}
                                valueStyle={{ color: '#cf1322' }}
                            />
                        </Card>
                    </Col>
                </Row>
            </div>
        );
    }
}

export default EchartsTest;